import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {TitleForm, TitleQuery, TitleVO} from "@/api/advertisement/title/types";

/**
 * 查询巨量广告标题、产品卖点、行动号召列表
 * @param query
 * @returns {*}
 */

export const listTitle = (query?: TitleQuery): AxiosPromise<TitleVO[]> => {
  return request({
    url: '/oce/title/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巨量广告标题、产品卖点、行动号召详细
 * @param id
 */
export const getTitle = (id: string | number): AxiosPromise<TitleVO> => {
  return request({
    url: '/oce/title/' + id,
    method: 'get'
  });
};

/**
 * 新增巨量广告标题、产品卖点、行动号召
 * @param data
 */
export const addTitle = (data: TitleForm) => {
  return request({
    url: '/oce/title',
    method: 'post',
    data: data
  });
};

/**
 * 修改巨量广告标题、产品卖点、行动号召
 * @param data
 */
export const updateTitle = (data: TitleForm) => {
  return request({
    url: '/oce/title',
    method: 'put',
    data: data
  });
};

/**
 * 删除巨量广告标题、产品卖点、行动号召
 * @param id
 */
export const delTitle = (id: string | number | Array<string | number>) => {
  return request({
    url: '/oce/title/' + id,
    method: 'delete'
  });
};
